package br.com.actionsystem.gdp.util;

import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.PlainDocument;

public class TextNumber extends PlainDocument {

	public TextNumber() {
		super();

	}

	@Override
	public void insertString(int offset, String str, AttributeSet attr)
			throws BadLocationException {
		if (str == null)
			return;
		char[] array = str.toCharArray();
		char c = array[0];
		if (c > 47 && c < 58 || c == 44 || c == 46) {
			super.insertString(offset, str, attr);

		} else {
			return;
		}

	}
}